package com.controller.sys.role;

import com.model.base.Result;

import com.core.springSecurity.service.PermissionService;
import com.model.vo.sys.role.GetPermissionListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: zql
 * @Description: 权限列表
 * @Data: 9:24 2021/5/12
 */
@Api(tags = {"角色"})
@Slf4j
@RestController
@RequestMapping("/v1")
public class PermissionController {
    /**
     * @Author: zql
     * @Description: 获取权限列表
     * @Data: 9:23 2021/5/12
     */
    @ApiOperation(value = "查看权限列表")
    //@Log(title = "查看权限列表" ,businessType = BusinessType.OTHER, isSaveResponseData = false)
    @PostMapping("/getPermissionList")
    @PreAuthorize("@ss.hasAnyPermi('" + PermissionService.SYSTEM_OPERATE + "')")
    public Result<List<GetPermissionListVO>> getPermissionList() {
        return Result.suc(PermissionService.getPermissionList().toJavaList(GetPermissionListVO.class));
    }
}
